<?php

include '../Core/function.php';

$data = include '../database/database.php';

if( $_POST ){

	foreach ($_POST as $key => $value) {

		if( $value == '' ){
			error('../index.php','文本框不能为空');
		}
		
	}
	$id = (int)$_POST['id'];

	foreach ($data as $key => $value) {

			$data[$id]['username'] = $_POST['username'];

			$data[$id]['msginfo'] = $_POST['msginfo'];

	}

	$data = var_export( $data, true );

	$str = "<?php return ".$data." ?>";

	file_put_contents( '../database/database.php' , $str );

	success('../index.php', '修改成功');

}else{

	error('../index.php', '非法访问');

}


?>